/*
 * Created by 岱青海蓝信息系统(北京)有限公司 on 17-7-6 下午5:50
 * Copyright (c) 2017. All rights reserved.
 */

package com.example.dqhl.jdmetro.activities;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.example.dqhl.jdmetro.R;
import com.example.dqhl.jdmetro.base.BaseActivity;
import com.example.dqhl.jdmetro.utils.Dlog;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * description:消息详情
 * autour:guanluocang
 * date:17/7/6 17:50
 */
public class MyInfoDeatilActivity extends BaseActivity {

    private String info_id = "";

    @Bind(R.id.webview_myInfoDetail)
    WebView webview_myInfoDetail;
    @Override
    public void initView(Bundle savedInstanceState) {
        setContentView(R.layout.activity_my_info_deatil);
        ButterKnife.bind(this);
        initTitleBar(R.string.txt_infoDetail);
        setRightTextVisibility(View.GONE);
    }

    @Override
    public void initData() {
        info_id = getIntent().getStringExtra("info_id");
        doData();
    }

    private void doData() {
        Dlog.e(info_id+"  "+user.getId_auth());
        //设置此属性，可任意比例缩放
//        webView.getSettings().setUseWideViewPort(true);
//        webView.getSettings().setLoadWithOverviewMode(true);
        // 设置自动加载图片
        webview_myInfoDetail.getSettings().setLoadsImagesAutomatically(true);
        //支持缩放
        webview_myInfoDetail.getSettings().setBuiltInZoomControls(false);
        //设置是否支持变焦
        webview_myInfoDetail.getSettings().setSupportZoom(true);
        //  这是webview保存表单数据
        webview_myInfoDetail.getSettings().setSaveFormData(false);
        //自适应屏幕
//        webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
//        webView.getSettings().setLoadWithOverviewMode(true);
        //启用支持javascript
        webview_myInfoDetail.getSettings().setJavaScriptEnabled(true);
        // 优先使用缓存
        webview_myInfoDetail.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); //  不使用缓存 只从网络获取数据
        webview_myInfoDetail.loadUrl("http://jdxc.qline.com.cn/Api/News/newsContent?id="+info_id+"&id_auth="+user.getId_auth()+"");
    }

    @Override
    public void initListener() {

    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }
}
